import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import en from 'element-plus/dist/locale/en.mjs'
import { computed } from 'vue'
import { defineStore } from 'pinia'
import { useStorage } from '@vueuse/core'

export const useAppStore = defineStore('app', () => {
  const size = useStorage<'large' | 'default' | 'small'>('size', 'default')

  const languageObj: any = {
    en_US: en,
    zh_CN: zhCn
  }

  const locale = computed(() => {
    return languageObj[locale.value]
  })

  return { locale, size }
})
